home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
C++ Spline Class V 1.02
/
C++ Spline Class 1.02.sea
/
Spline Class
/
2DSpline.h
< prev
next >
Wrap
Text File
|
1993-09-30
|
5KB
|
112 lines
/************************************************************************************************/
/* Chris Marshall */
/* */
/* Nikon Electronic Imaging Dept */
/* 1300 Walt Whitman Road */
/* Melville, NY 11747 */
/* (516) 547-4200 */
/* */
/************************************************************************************************/
/* File Name: 2DSpline.h */
/* Description: Declaration file for a 2-dimensional spline curve */
/* Primary Author: Chris Marshall - based on an algorithm modified by Tom Knoll */
/* Version: 1.0 */
/* Project: Library file */
/* Compiler(s): Symantec C++ 6.0 */
/************************************************************************************************/
/* MODIFICATION HISTORY */
/************************************************************************************************/
/* Date Author Description */
/* */
/************************************************************************************************/
#pragma once // This include file should only be used once
#include <FixMath.h>
/************************************************************************************************/
/* CLASS DEFINITION */
/************************************************************************************************/
class Spline
{
private:
long double **fSlopeArray;
long double **fPAl1;
long double **fPAl2;
long double **fPAl3;
void Initialize ( void );
protected:
short fNumPoints;
short fSelectedPoint;
long **fXArray;
long **fYArray;
long fHitRadius;
short fAlloc;
virtual void CreateCoefficients ( void );
public:
Spline ( long x0, long y0, long x1, long x1,
long hitRadius );
Spline ( void ) { this->Initialize ( ); };
virtual ~Spline ( void );
virtual short AddSplinePoint ( long xValue, long yValue );
Boolean PointIsOnLine ( long & xValue, long & yValue );
short IsASplinePoint ( long & xValue, long & yValue, Boolean xOnly );
short IsASplinePoint ( long & xValue, long & yValue )
{ return this->IsASplinePoint ( xValue, yValue, false ); };
short IsASplinePoint ( long & xValue )
{ long temp; return this->IsASplinePoint ( xValue, temp, false ); };
short PointIsBetween ( long xValue, short & above, short & below );
short GetSplinePoint ( short index, long & xValue, long & yValue );
short GetSplinePoint ( long & xValue, long & yValue )
{ this->GetSplinePoint ( fSelectedPoint, xValue, yValue ); return fSelectedPoint; };
virtual void DeleteSplinePoint ( short index );
void DeleteSplinePoint ( void ) { this->DeleteSplinePoint ( fSelectedPoint ); };
void ChangeSplinePoint ( short & index, long xValue, long yValue );
short ChangeSplinePoint ( long xValue, long yValue )
{ this->ChangeSplinePoint ( fSelectedPoint, xValue, yValue ); return fSelectedPoint; };
short GetNumberOfSplinePoints ( void ) { return fNumPoints; };
virtual long GetYValue ( long xValue );
virtual long double GetRealYValue ( long double xValue );
virtual Fixed GetFixYValue ( Fixed xValue )
{ return X2Fix ( this->GetRealYValue ( Fix2X ( xValue ) ) ); };
void SetHitRadius ( long hitRadius ) { fHitRadius = hitRadius; };
long GetHitRadius ( long hitRadius ) { return fHitRadius; };
void SelectPoint ( short index ) { fSelectedPoint = index; };
short GetSelectedPoint ( void ) { return fSelectedPoint; };
};
#define kInc 16 // The size of the blocks for allocating the working buffers
class FixedSpline : public Spline
{
private:
Fixed **fFixedArray;
Fixed **fPAf1;
Fixed **fPAf2;
Fixed **fPAf3;
void CreateCoefficients ( void );
void Initialize ( void );
public:
FixedSpline ( long x0, long y0, long x1, long x1, long hitRadius );
FixedSpline ( void ) { this->Initialize ( ); };
virtual ~FixedSpline ( void );
short AddSplinePoint ( long xValue, long yValue );
void DeleteSplinePoint ( short index );
Fixed GetFixYValue ( Fixed xValue );
long GetYValue ( long xValue )
{ return Fix2Long ( this->GetFixYValue ( xValue << 16 ) ); };
long double GetRealYValue ( long double xValue )
{ return Fix2X ( this->GetFixYValue ( X2Fix ( xValue ) ) ); };
};
/************************************************************************************************/